import Vue from 'vue'
import Router from 'vue-router'
import Home from '../components/Home.vue'
import Menu from '../components/Menu.vue'
import Admin from '../components/Admin.vue'
import About from '../components/about/About.vue'
import Regsiter from '../components/Regsiter.vue'
import Login from '../components/Login.vue'

//二级路由
import Contact from '../components/about/Contact.vue'
import History from '../components/about/History.vue'
import Delivery from '../components/about/Delivery.vue'
import OderringGuide from '../components/about/OderringGuide.vue'
import Phone from '../components/about/contact/phone.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  // scrollBehavior(to, from, savedPosition) {
  //   //return { x: 0, y: 100 }
  //   //return {selector :'.btn'}
  //   // if (savedPosition) {
  //   //   return savedPosition
  //   // } else {
  //   //   return { x: 0, y: 0 }
  //   // }
  // },
  routes: [
    {
      path: '*',
      redirect: '/'
    },
    {
      path: '/',
      name: 'Home',
      components: {
        default: Home,
        'OderringGuide': OderringGuide,
        'Delivery': Delivery,
        'History': History
      }
    },
    {
      path: '/Menu',
      name: 'menu',
      component: Menu
    },
    {
      path: '/Admin',
      name: 'Admin',
      component: Admin
    },
    {
      path: '/About',
      name: 'About',
      component: About,
      children: [
        {
          path: '/Contact',
          name: 'Contact',
          component: Contact,
          children: [
            {
              path: '/phone',
              name: "phoneNumber",
              component: Phone
            }
          ]
        },
        {
          path: '/History',
          name: 'History',
          component: History
        }
        ,
        {
          path: '/Delivery',
          name: 'Delivery',
          component: Delivery
        }
        ,
        {
          path: '/OderringGuide',
          name: 'OderringGuide',
          component: OderringGuide
        }
      ]
    },
    {
      path: '/Regsiter',
      name: 'Regsiter',
      component: Regsiter
    },
    {
      path: '/Login',
      name: 'Login',
      component: Login
    },

  ]
})
